package oop2.Task;
import java.util.Scanner;
public class Calculator {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        Calculator ss = new Calculator();
        int choice=0;
       while (true){
           System.out.println("计算器算数 1:加法，2:减法，3:乘法,4:除法，5:三次方，6:退出");
           System.out.print("选择要进行的运算:");
           choice=input.nextInt();
           if(choice==1){
               System.out.print("请输入两个数:");
               int a=input.nextInt();
               int b=input.nextInt();
               System.out.println(a+"+"+b+"="+ss.add(a,b));
           }else if(choice==2){
               System.out.print("请输入两个数:");
               int a=input.nextInt();
               int b=input.nextInt();
               System.out.println(a+"-"+b+"="+ss.subtract(a,b));
           }else if(choice==3){
               System.out.print("请输入两个数:");
               int a=input.nextInt();
               int b=input.nextInt();
               System.out.println(a+"*"+b+"="+ss.multiply(a,b));
           }else if(choice==4){
               System.out.print("请输入两个数:");
               int a=input.nextInt();
               int b=input.nextInt();
               System.out.println(a+"/"+b+"="+ss.division(a,b));
           }else if(choice==5){
               System.out.print("输入要进行立方运算的数:");
               int d=input.nextInt();
               System.out.println(d+"*"+d+"*"+d+"="+ss.multiplyThressTimes(d));
           }else if(choice==6){
               System.out.println("退出");
               break;
           }
       }
    }


    public double add(double a, double b) {         //加法
      return a+b;
    }

    public double subtract(double a, double b) {    //减法
        return a-b;
    }

    public double multiply(double a, double b){     //乘法
        return a*b;
    }

    public double division(double a, double b){     //除法
        return a/b;
    }

    public double multiplyThressTimes(double a){     //三次方
        return a*a*a;
    }

}
